package com.jzo2o.customer.mapper;

import com.jzo2o.customer.model.domain.AgencyCertificationAudit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.AgencyCertificationAuditResDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.checkerframework.checker.units.qual.C;
import org.springframework.web.bind.annotation.PathVariable;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 机构认证信息审核表 Mapper 接口
 * </p>
 *
 * @author xd
 * @since 2024-12-12
 */
public interface AgencyCertificationAuditMapper extends BaseMapper<AgencyCertificationAudit> {

    @Select("select reject_reason from agency_certification_audit where serve_provider_id=#{id} order by create_time limit 1")
    String selectReasonByServeProviderId(Long id);

    /**
     * @author xd
     * 审核机构认证分页查询
     * @param dto 分页条件实体类
     * @return 分页结果包装类
     */
    List<AgencyCertificationAuditResDTO> pageQuery(AgencyCertificationAuditPageQueryReqDTO dto);

    /**
     * @author xd
     * 审核机构认证信息
     * @param certificationAudit {@code AgencyCertificationAudit} 审核信息包装类
     */
    Integer audit(AgencyCertificationAudit certificationAudit);

    /**
     * 根据机构id查询审核信息
     * @param serveProviderId {@code Long} 机构id
     * @return  agencyCertificationAudit {@code AgencyCertificationAudit} 审核信息实体类
     */
    @Select("select * from agency_certification_audit where serve_provider_id=#{serveProviderId}")
    AgencyCertificationAudit selectByServeProviderId(Long serveProviderId);

}
